package com.linhh.mall.center.web.controller;

import com.linhh.mall.center.api.TbLandCoordinateService;
import com.linhh.mall.center.common.pojo.TbLandCoordinate;
import org.apache.dubbo.config.annotation.Reference;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @Author linhh
 * @Date 2023 03 20 14 33
 **/
@RestController
@RequestMapping("/api/Coordinate")
public class TbLandCoordinateController {

    @Reference
    private TbLandCoordinateService tbLandCoordinateService;

    @GetMapping("/all")
    public List<TbLandCoordinate> getLandCoordinates(){
        return tbLandCoordinateService.selectAll();
    }

    @DeleteMapping("/delete/{id}")
    public int deleteLandCoordinate(@PathVariable Long id){
        return tbLandCoordinateService.deleteTbLandCoordinate(id);
    }
    @PostMapping("/add")
    public int addLandCoordinate(@RequestBody TbLandCoordinate tbLandCoordinate){
        return tbLandCoordinateService.addTbLandCoordinate(tbLandCoordinate);
    }

    @PutMapping("/update")
    public int updateLandCoordinate(@RequestBody TbLandCoordinate tbLandCoordinate){
        return tbLandCoordinateService.updateTbLandCoordinate(tbLandCoordinate);
    }

    @GetMapping("/findByLandId/{landId}")
    public TbLandCoordinate getCoordinateByLandId(@PathVariable Long landId){
        return tbLandCoordinateService.selectCoordinateByLandId(landId);
    }

}
